<%@ page import="java.sql.*, model.Loan, util.*, org.hibernate.*"%> 

<html>

<%
try{
HibernateUtil.getSession().beginTransaction(); 
Loan loan = (Loan) HibernateUtil.getSession().get(Loan.class, Integer.valueOf(request.getParameter("id"))); 

%>

<body>
	<form action="loan" method="post">
	Valor total que deve ser pago: <%=loan.getValue() %> <br/>
	Valor que voce deseja pagar: <input type="text" name="payment"/> <br/> 	
	<input type="hidden" name="loanID" value="<%= loan.getId()%>"/> <br/>
	<input type="hidden" name="investorID" value="<%= session.getAttribute("uid")%>"/> <br/>
	<input type="submit" value="Pagar"/>
	
	<input type="hidden" name="action" value="pagamento"/> <br/>
	
	</form>
	</div>

<% HibernateUtil.getSession().getTransaction().commit();
} catch(Exception e) {
	HibernateUtil.getSession().getTransaction().rollback();
	throw e;
}
%>

</body>
</html>